package com.yulian.util;

import io.netty.util.internal.logging.InternalLogger;
import io.netty.util.internal.logging.Log4JLoggerFactory;

import java.time.LocalDateTime;

/**
 * @author: renzhenghang
 * date: 2023/7/22 12:07
 * @since: JDK 1.8
 * @description: 生成单据号工具类
 */
public class GenerateOrderNumberUtils {
    final static InternalLogger log = Log4JLoggerFactory.getInstance(GenerateOrderNumberUtils.class);

    public static String getWithdrawalPlan(String type, String chinese, Integer orderNumber) {
        StringBuilder string = new StringBuilder();
        string.append(type);
        string.append("-");
        string.append(ChineseCharacterHelper.getSpells(chinese, 2));
        string.append("-");
        LocalDateTime currentLocalDateTime = TimeUtils.getCurrentLocalDateTime();
        string.append(TimeUtils.dateTimeFormatterString(currentLocalDateTime, "YYYY").substring(2));
        string.append(TimeUtils.dateTimeFormatterString(currentLocalDateTime, "MM"));
        string.append(TimeUtils.dateTimeFormatterString(currentLocalDateTime, "dd"));
        string.append(orderNumber);
        return string.toString();
    }


    public static String getWithdrawalPlan2(String type, String chinese, String chinese1, Integer orderNumber) {
        StringBuilder string = new StringBuilder();
        string.append(type);
        string.append("-");
        string.append(ChineseCharacterHelper.getSpells(chinese, 2));
        string.append("-");
        string.append(ChineseCharacterHelper.getSpells(chinese1, 2));
        string.append("-");
        LocalDateTime currentLocalDateTime = TimeUtils.getCurrentLocalDateTime();
        string.append(TimeUtils.dateTimeFormatterString(currentLocalDateTime, "YYYY").substring(2));
        string.append(TimeUtils.dateTimeFormatterString(currentLocalDateTime, "MM"));
        string.append(TimeUtils.dateTimeFormatterString(currentLocalDateTime, "dd"));
        string.append(orderNumber);
        return string.toString();
    }
}
